/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.admanager.soadmanagement.plugin.soadmanagement.impl;

import java.util.Collection;

import org.admanager.soadmanagement.plugin.soadmanagement.ComponentMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.ComponentReferenceMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.ComponentServiceMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.CompositeMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.DocumentRoot;
import org.admanager.soadmanagement.plugin.soadmanagement.Pattern;
import org.admanager.soadmanagement.plugin.soadmanagement.ReferenceMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.RootMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.ServiceMapping;
import org.admanager.soadmanagement.plugin.soadmanagement.soadmanagementPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Root Mapping</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getCompositemapping <em>Compositemapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getComponentmapping <em>Componentmapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getReferencemapping <em>Referencemapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getServicemapping <em>Servicemapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getComponentreferencemapping <em>Componentreferencemapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getComponentservicemapping <em>Componentservicemapping</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getScacomposite <em>Scacomposite</em>}</li>
 *   <li>{@link org.admanager.soadmanagement.plugin.soadmanagement.impl.RootMappingImpl#getSoapattern <em>Soapattern</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RootMappingImpl extends EObjectImpl implements RootMapping {
	/**
	 * The cached value of the '{@link #getCompositemapping() <em>Compositemapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompositemapping()
	 * @generated
	 * @ordered
	 */
	protected EList compositemapping;

	/**
	 * The cached value of the '{@link #getComponentmapping() <em>Componentmapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getComponentmapping()
	 * @generated
	 * @ordered
	 */
	protected EList componentmapping;

	/**
	 * The cached value of the '{@link #getReferencemapping() <em>Referencemapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getReferencemapping()
	 * @generated
	 * @ordered
	 */
	protected EList referencemapping;

	/**
	 * The cached value of the '{@link #getServicemapping() <em>Servicemapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getServicemapping()
	 * @generated
	 * @ordered
	 */
	protected EList servicemapping;

	/**
	 * The cached value of the '{@link #getComponentreferencemapping() <em>Componentreferencemapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getComponentreferencemapping()
	 * @generated
	 * @ordered
	 */
	protected EList componentreferencemapping;

	/**
	 * The cached value of the '{@link #getComponentservicemapping() <em>Componentservicemapping</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getComponentservicemapping()
	 * @generated
	 * @ordered
	 */
	protected EList componentservicemapping;

	/**
	 * The cached value of the '{@link #getScacomposite() <em>Scacomposite</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getScacomposite()
	 * @generated
	 * @ordered
	 */
	protected DocumentRoot scacomposite;

	/**
	 * The cached value of the '{@link #getSoapattern() <em>Soapattern</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSoapattern()
	 * @generated
	 * @ordered
	 */
	protected Pattern soapattern;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RootMappingImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return soadmanagementPackage.Literals.ROOT_MAPPING;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getCompositemapping() {
		if (compositemapping == null) {
			compositemapping = new EObjectContainmentEList(CompositeMapping.class, this, soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING);
		}
		return compositemapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getComponentmapping() {
		if (componentmapping == null) {
			componentmapping = new EObjectContainmentEList(ComponentMapping.class, this, soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING);
		}
		return componentmapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getReferencemapping() {
		if (referencemapping == null) {
			referencemapping = new EObjectContainmentEList(ReferenceMapping.class, this, soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING);
		}
		return referencemapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getServicemapping() {
		if (servicemapping == null) {
			servicemapping = new EObjectContainmentEList(ServiceMapping.class, this, soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING);
		}
		return servicemapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getComponentreferencemapping() {
		if (componentreferencemapping == null) {
			componentreferencemapping = new EObjectContainmentEList(ComponentReferenceMapping.class, this, soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING);
		}
		return componentreferencemapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList getComponentservicemapping() {
		if (componentservicemapping == null) {
			componentservicemapping = new EObjectContainmentEList(ComponentServiceMapping.class, this, soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING);
		}
		return componentservicemapping;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DocumentRoot getScacomposite() {
		return scacomposite;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetScacomposite(DocumentRoot newScacomposite, NotificationChain msgs) {
		DocumentRoot oldScacomposite = scacomposite;
		scacomposite = newScacomposite;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE, oldScacomposite, newScacomposite);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setScacomposite(DocumentRoot newScacomposite) {
		if (newScacomposite != scacomposite) {
			NotificationChain msgs = null;
			if (scacomposite != null)
				msgs = ((InternalEObject)scacomposite).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE, null, msgs);
			if (newScacomposite != null)
				msgs = ((InternalEObject)newScacomposite).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE, null, msgs);
			msgs = basicSetScacomposite(newScacomposite, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE, newScacomposite, newScacomposite));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Pattern getSoapattern() {
		return soapattern;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSoapattern(Pattern newSoapattern, NotificationChain msgs) {
		Pattern oldSoapattern = soapattern;
		soapattern = newSoapattern;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, soadmanagementPackage.ROOT_MAPPING__SOAPATTERN, oldSoapattern, newSoapattern);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSoapattern(Pattern newSoapattern) {
		if (newSoapattern != soapattern) {
			NotificationChain msgs = null;
			if (soapattern != null)
				msgs = ((InternalEObject)soapattern).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - soadmanagementPackage.ROOT_MAPPING__SOAPATTERN, null, msgs);
			if (newSoapattern != null)
				msgs = ((InternalEObject)newSoapattern).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - soadmanagementPackage.ROOT_MAPPING__SOAPATTERN, null, msgs);
			msgs = basicSetSoapattern(newSoapattern, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, soadmanagementPackage.ROOT_MAPPING__SOAPATTERN, newSoapattern, newSoapattern));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING:
				return ((InternalEList)getCompositemapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING:
				return ((InternalEList)getComponentmapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING:
				return ((InternalEList)getReferencemapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING:
				return ((InternalEList)getServicemapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING:
				return ((InternalEList)getComponentreferencemapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING:
				return ((InternalEList)getComponentservicemapping()).basicRemove(otherEnd, msgs);
			case soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE:
				return basicSetScacomposite(null, msgs);
			case soadmanagementPackage.ROOT_MAPPING__SOAPATTERN:
				return basicSetSoapattern(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING:
				return getCompositemapping();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING:
				return getComponentmapping();
			case soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING:
				return getReferencemapping();
			case soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING:
				return getServicemapping();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING:
				return getComponentreferencemapping();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING:
				return getComponentservicemapping();
			case soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE:
				return getScacomposite();
			case soadmanagementPackage.ROOT_MAPPING__SOAPATTERN:
				return getSoapattern();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING:
				getCompositemapping().clear();
				getCompositemapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING:
				getComponentmapping().clear();
				getComponentmapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING:
				getReferencemapping().clear();
				getReferencemapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING:
				getServicemapping().clear();
				getServicemapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING:
				getComponentreferencemapping().clear();
				getComponentreferencemapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING:
				getComponentservicemapping().clear();
				getComponentservicemapping().addAll((Collection)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE:
				setScacomposite((DocumentRoot)newValue);
				return;
			case soadmanagementPackage.ROOT_MAPPING__SOAPATTERN:
				setSoapattern((Pattern)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING:
				getCompositemapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING:
				getComponentmapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING:
				getReferencemapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING:
				getServicemapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING:
				getComponentreferencemapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING:
				getComponentservicemapping().clear();
				return;
			case soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE:
				setScacomposite((DocumentRoot)null);
				return;
			case soadmanagementPackage.ROOT_MAPPING__SOAPATTERN:
				setSoapattern((Pattern)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case soadmanagementPackage.ROOT_MAPPING__COMPOSITEMAPPING:
				return compositemapping != null && !compositemapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTMAPPING:
				return componentmapping != null && !componentmapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__REFERENCEMAPPING:
				return referencemapping != null && !referencemapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__SERVICEMAPPING:
				return servicemapping != null && !servicemapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTREFERENCEMAPPING:
				return componentreferencemapping != null && !componentreferencemapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__COMPONENTSERVICEMAPPING:
				return componentservicemapping != null && !componentservicemapping.isEmpty();
			case soadmanagementPackage.ROOT_MAPPING__SCACOMPOSITE:
				return scacomposite != null;
			case soadmanagementPackage.ROOT_MAPPING__SOAPATTERN:
				return soapattern != null;
		}
		return super.eIsSet(featureID);
	}

} //RootMappingImpl
